#!/bin/bash

HOST_0="deepseek-example-0.deepseek-example.default.svc"
MYSELF="deepseek-example-1.deepseek-example.default.svc"

while true; do
  HEAD_NODE_ADDRESS=$(getent hosts $HOST_0|awk '{print $1}')

  [ -n "$HEAD_NODE_ADDRESS" ] || { echo "[init_1.sh]dnslookup $HOST_0" >&2; sleep 2; continue; }
  
  break
  
done


while true; do
  MY_IP=$(getent hosts $MYSELF|awk '{print $1}')

  [ -n "$MY_IP" ] || { echo "[init_1.sh]dnslookup $MYSELF" >&2;  sleep 2; continue; }

  break
done

export VLLM_HOST_IP=$MY_IP

#export GLOO_SOCKET_IFNAME=eth0

#export TP_SOCKET_IFNAME=eth0

echo "[init_1.sh]$VLLM_HOST_IP $MYSELF" >&2

ray start --block --address=${HEAD_NODE_ADDRESS}:6379 &

